package com.liry.security.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liry.security.domain.entity.SysUser;
import com.liry.security.repository.SysUserRepository;
import com.liry.security.repository.mapper.SysUserMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @author ALI
 * @since 2023/5/29
 */
@Component
@AllArgsConstructor
public class SysUserRepositoryImpl implements SysUserRepository {
    private SysUserMapper sysUserMapper;
    @Override
    public SysUser getByUsername(String username) {
        LambdaQueryWrapper<SysUser> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(SysUser::getUsername, username);
        return sysUserMapper.selectOne(wrapper);
    }
}
